<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>013Basic_Environment</title>
    <link href="../CSS/normalize.min.css"  rel="stylesheet">
    <link href="../CSS/slideout.css"  rel="stylesheet">
    <link href="../CSS/github.css"  rel="stylesheet">
    <link href="../CSS/github.css"  rel="stylesheet">
    <link href="../CSS/font-awesome.min.css"  rel="stylesheet">
    <link href="../CSS/perfect-scrollbar.min.css"  rel="stylesheet">
    <link href="../CSS/main.css"  rel="stylesheet">
</head>
<body>
<!--@@下面是翻译正文@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@-->

<nav id="menu"></nav><nav class="nav-main"><!-- Hamburger menu : displayed only in small screens-->
    <i class="fa fa-bars" id="mobilemenu"></i><!-- this button only shows on mobile version of a "class" page-->
    <div class="banner">
        <div class="menu">
            <div class="do-not-hover" id="home"><a style="cursor: help;" href="http://doc.babylonjs.com/">Babylon.js | DOCUMENTATION</a></div>
            <div class="item" id="whatsnew"><a style="cursor: help;" href="http://doc.babylonjs.com/whats-new">What's new</a></div>
            <div class="item" id="general"><a style="cursor: help;" href="http://doc.babylonjs.com/generals">General</a></div>
            <div class="item active" id="tutorials"><a style="cursor: help;" href="http://doc.babylonjs.com/tutorials">Tutorials</a></div>
            <div class="item" id="overview"><a style="cursor: help;" href="http://doc.babylonjs.com/overviews">Overviews</a></div>
            <div class="item" id="exporters"><a style="cursor: help;" href="http://doc.babylonjs.com/exporters">Exporters</a></div>
            <div class="item" id="extensions"><a style="cursor: help;" href="http://doc.babylonjs.com/extensions">Extensions</a></div>
            <div class="item" id="classes"><a style="cursor: help;" href="http://doc.babylonjs.com/classes">Classes</a></div>
            <div class="item" id="playground"><a style="border-image: none; cursor: help;" href="http://doc.babylonjs.com/playground">Playground</a></div></div>
        <div class="more">
            <div class="searchbar">
                <form action="/search" method="get"><input name="q" type="text" placeholder="Search..." value=""><button type="submit"><i class="fa fa-search"></i></button></form></div></div></div></nav>
<div id="wrapper">
    <div class="statics-banner">
        <h1 style="border-image: none; cursor: help;">教程</h1></div>
    <div class="horizontal-separator"></div>
    <div class="static-content">
        <h1 style="border-image: none; cursor: help;">环境</h1><br>
        <div class="contentTable">
            <div class="tocHeader"><span class="tocTitle" style="border-image: none; cursor: help;"><i class="tocIcon fa fa-book"></i>内容列表</span><span class="tocToggle"><i class="fa fa-arrow-up"></i></span></div>
            <div class="tocContent">
                <ul>
                    <li><a style="border-image: none; cursor: help;" href="http://doc.babylonjs.com/tutorials/Environment#introduction">简介</a></li>
                    <li><a style="border-image: none; cursor: help;" href="http://doc.babylonjs.com/tutorials/Environment#how-can-i-do-this">怎么做?</a>
                        <ul>
                            <li><a style="border-image: none; cursor: help;" href="http://doc.babylonjs.com/tutorials/Environment#changing-the-background-color-sceneclearcolor">改变背景颜色 (<code style="border-image: none; cursor: help;">scene.clearColor</code>)</a></li>
                            <li><a style="border-image: none; cursor: help;" href="http://doc.babylonjs.com/tutorials/Environment#changing-the-ambient-color-sceneambientcolor">改变环境颜色 (<code style="border-image: none; cursor: help;">scene.ambientColor</code>)</a></li>
                            <li><a style="border-image: none; cursor: help;" href="http://doc.babylonjs.com/tutorials/Environment#skybox">天空盒</a></li>
                            <li><a style="border-image: none; cursor: help;" href="http://doc.babylonjs.com/tutorials/Environment#fog">雾</a></li></ul></li>
                    <li><a style="border-image: none; cursor: help;" href="http://doc.babylonjs.com/tutorials/Environment#next-step">下一步</a></li></ul></div></div>
        <div id="staticContent">
            <h2 style="border-image: none; cursor: help;"><a name="introduction" class="anchor" href="http://doc.babylonjs.com/tutorials/Environment#introduction"></a>简介</h2>
            <p style="border-image: none; cursor: help;">你已经走了很远，学习了形状、光照、精灵、粒子、材质。但是你的场景中仍然缺少一些东西：一个优美的环境。这是讨论环境因素和效果的连续的三个教程中的第一个。我们将从简单的场景<code style="cursor: help;">clearColor</code> (背景色)开始,   然后简略的讨论场景的              <code style="cursor: help;">ambientColor</code>, 然后通过六纹理天空盒和雾来给你的场景带来深度的显示模拟.</p>
            <p><img alt="Environment" src="../IMAGE/11-15/13.png"></p>
            <p><em style="border-image: none; cursor: help;">一张图片展示Babylonjs运动的雾</em></p>
            <h2 style="border-image: none; cursor: help;"><a name="how-can-i-do-this" class="anchor" href="http://doc.babylonjs.com/tutorials/Environment#how-can-i-do-this"></a>怎么做?</h2>
            <p style="border-image: none; cursor: help;">我们将慢慢地讨论这个美丽的雾效。首先，我希望向你介绍两个有趣的属性在<a style="border-image: none; cursor: help;" href="http://doc.babylonjs.com/classes/Scene">场景类对象中</a>:</p>
            <ul>
                <li style="border-image: none; cursor: help;"><code style="border-image: none; cursor: help;">scene.clearColor</code> - 改变 '背景' 颜色.</li>
                <li style="border-image: none; cursor: help;"><code style="border-image: none; cursor: help;">scene.ambientColor</code> -改变几个效果中的颜色，包括环境光.</li></ul>
            <p style="border-image: none; cursor: help;">它们都是很有用的，并且在它们的领域里十分有效.</p>
            <h3 style="border-image: none; cursor: help;"><a name="changing-the-background-color-codesceneclearcolorcode" class="anchor" href="http://doc.babylonjs.com/tutorials/Environment#changing-the-background-color-sceneclearcolor"></a>改变背景颜色 (<code style="cursor: help;">scene.clearColor</code>)</h3>
            <p style="border-image: none; cursor: help;">这个场景对象的 'clearColor' 属性是最基础的环境属性/可调整项。简单情况下，这代表着你如何改变场景的背景颜色。以下是他如何工作:</p>
<pre><code class="lang-javascript hljs" style="border-image: none; cursor: help;">scene.clearColor = new BABYLON.Color3(0.5, 0.8, 0.5);
</code></pre>
            <p style="border-image: none; cursor: help;">或者你可能希望使用我们提供的颜色来避免使用<code style="border-image: none; cursor: help;">new</code>关键词:</p>
<pre><code class="lang-javascript hljs" style="border-image: none; cursor: help;">scene.clearColor = BABYLON.Color3.Blue();
</code></pre>
            <p style="border-image: none; cursor: help;">这个颜色和属性并不在任何关于网格、材质、纹理或者其他对象的最终颜色计算中使用。他只是场景的背景颜色而已。轻松。</p>
            <h3 style="border-image: none; cursor: help;"><a name="changing-the-ambient-color-codesceneambientcolorcode" class="anchor" href="http://doc.babylonjs.com/tutorials/Environment#changing-the-ambient-color-sceneambientcolor"></a>改变环境颜色 (<code style="border-image: none; cursor: help;">scene.ambientColor</code>)</h3>
            <p style="border-image: none; cursor: help;">反过来，<code style="border-image: none; cursor: help;">ambientColor</code>属性对于场景对象是一个非常强大并且有影响力的属性/可调整项。首先，让我们来看一下它的语法：</p>
<pre><code class="lang-javascript hljs" style="border-image: none; cursor: help;">scene.ambientColor = new BABYLON.Color3(0.3, 0.3, 0.3);
</code></pre>
            <p style="border-image: none; cursor: help;">正如你所见，它使用与<code style="border-image: none; cursor: help;">clearColor</code>相同的格式，但是<code style="border-image: none; cursor: help;">ambientColor</code>在很多决定场景事物最终颜色的计算中起作用。它主要被用于与<code style="border-image: none; cursor: help;">StandardMaterial.ambientColor</code>结合来决定最终的<code style="border-image: none; cursor: help;">ambientColor</code> 对于网格的材质. </p>
            <p style="border-image: none; cursor: help;">你将发现在没有<code style="border-image: none; cursor: help;">scene.ambientColor</code>时, 这时
                <code style="border-image: none; cursor: help;">StandardMaterial.ambientColor</code> 和               <code style="border-image: none; cursor: help;">StandardMaterial.ambientTexture</code>似乎没有任何作用。设置一个 <code style="border-image: none; cursor: help;">scene.ambientColor</code>为某值，就像上面的例子一样，然后
                <code style="border-image: none; cursor: help;">StandardMaterial.ambientColor</code>/<code style="border-image: none; cursor: help;">StandardMaterial.ambientTexture</code>将在你如此应用的网格上激活.</p>
            <p style="border-image: none; cursor: help;">默认情况下, <code style="border-image: none; cursor: help;">scene.ambientColor</code> 被设置为<code style="border-image: none; cursor: help;">Color3(0, 0,
                0)</code>, 这意味着没有<code style="border-image: none; cursor: help;">scene.ambientColor</code>.</p>
            <p style="border-image: none; cursor: help;">(请产看关于ambientColors的那一段在我们的<a style="border-image: none; cursor: help;" href="http://blogs.msdn.com/b/eternalcoding/archive/2013/07/01/babylon-js-unleash-the-standardmaterial-for-your-babylon-js-game.aspx">释放标准材质</a> 教程中，以获得更多信息.)</p>
            <h3 style="border-image: none; cursor: help;"><a name="skybox" class="anchor" href="http://doc.babylonjs.com/tutorials/Environment#skybox"></a>天空盒</h3>
            <p style="border-image: none; cursor: help;">为了获得一个美丽的晴朗天空的完美的模拟，我们将建立一个简单的盒子，但是通过一种特殊的纹理。</p>
            <p><img alt="Skybox" src="../IMAGE/11-15/13-1.png"></p>
            <p style="border-image: none; cursor: help;">首先，我们的盒子，没什么新的，只需要注意禁用<a style="border-image: none; cursor: help;" href="http://en.wikipedia.org/wiki/Back-face_culling">背面剔除</a>:</p>
<pre><code class="lang-javascript hljs" style="border-image: none; cursor: help;">var skybox = BABYLON.Mesh.CreateBox("skyBox", 100.0, scene);
    var skyboxMaterial = new BABYLON.StandardMaterial("skyBox", scene);
    skyboxMaterial.backFaceCulling = false;
    skyboxMaterial.disableLighting = true;
    skybox.material = skyboxMaterial;
</code></pre>
            <p style="border-image: none; cursor: help;">下一步，我们设置<code style="border-image: none; cursor: help;">infiniteDistance</code>属性。这使得天空盒跟随我们的相机的位置.</p>
<pre><code class="lang-javascript hljs" style="border-image: none; cursor: help;">skybox.infiniteDistance = true;
</code></pre>
            <p style="border-image: none; cursor: help;">现在我们必须移除我们盒子上的所有光照反射（阳光不会在天空上反射!）:</p>
<pre><code class="lang-javascript hljs" style="border-image: none; cursor: help;">skyboxMaterial.diffuseColor = new BABYLON.Color3(0, 0, 0);
    skyboxMaterial.specularColor = new BABYLON.Color3(0, 0, 0);
</code></pre>
            <p style="border-image: none; cursor: help;">下一步，我们应用特殊的天空纹理。这个纹理必须在一个专门的目录中准备好作为天空盒，在我们的例子中这个目录叫做“skybox”：</p>
<pre><code class="lang-javascript hljs" style="border-image: none; cursor: help;">skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture("textures/skybox", scene);
    skyboxMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE;
</code></pre>
            <p style="border-image: none; cursor: help;">(更多关于反射纹理的内容可以被找到在我们的<a style="border-image: none; cursor: help;" href="http://blogs.msdn.com/b/eternalcoding/archive/2013/07/01/babylon-js-unleash-the-standardmaterial-for-your-babylon-js-game.aspx">释放标准材质</a>教程中.)</p>
            <p style="border-image: none; cursor: help;">在这个<code style="border-image: none; cursor: help;">/skybox</code>目录中，我们必须找到六个天空纹理，每一个作为我们盒子的一个面。每一个图片必须被命名为对应的面：“skybox_nx.png”, “skybox_ny.png”, “skybox_nz.png”, “skybox_px.png”, “skybox_py.png”, “skybox_pz.png”.</p>
            <p><img alt="Skybox" src="../IMAGE/11-15/13-2.png"></p>
            <p style="border-image: none; cursor: help;">如果你想要一些免费的天空盒纹理例子，将你的浏览器指向: <a style="border-image: none; cursor: help;" href="http://3delyvisions.co/skf1.htm">http://3delyvisions.co/skf1.htm</a>（请在使用前阅读许可协议）就像你在哪些例子中看到的，天空盒纹理不只是单独的天空纹理。建筑、丘陵、山脉、湖、行星、星星，你都可以让他们作为天空盒纹理的一部分（都可以被很好的使用）。</p>
            <p style="border-image: none; cursor: help;">最终提示，如果你希望你的天空盒在所有其他物体之后渲染，设置天空盒的<code style="border-image: none; cursor: help;">renderingGroupId</code> to <code>0</code>, 然后把所有其他可渲染物体的<code style="border-image: none; cursor: help;">renderingGroupId</code> 设为大于零，举个例子:</p>
<pre><code class="lang-javascript hljs" style="border-image: none; cursor: help;">skybox.renderingGroupId = 0;

    // Some other mesh
    myMesh.renderingGroupId = 1;
</code></pre>
            <p style="border-image: none; cursor: help;">更多关于渲染分组和渲染顺序的内容可以被找到<a style="border-image: none; cursor: help;" href="http://doc.babylonjs.com/tutorials/Transparency_and_How_Meshes_Are_Rendered">在这里</a>.</p>
            <h3 style="border-image: none; cursor: help;"><a name="fog" class="anchor" href="http://doc.babylonjs.com/tutorials/Environment#fog"></a>雾</h3>
            <p style="border-image: none; cursor: help;">雾是一个很先进的效果，但是在Babylonjs中雾的使用被最大程度的简化了。现在在你的场景中添加雾非常的简单。首先，我们像这样定义雾的风格：</p>
<pre><code class="lang-javascript hljs" style="border-image: none; cursor: help;">scene.fogMode = BABYLON.Scene.FOGMODE_EXP;
</code></pre>
            <p style="border-image: none; cursor: help;">这里是可用的效果 :</p>
            <ul>
                <li style="border-image: none; cursor: help;"><code style="border-image: none; cursor: help;">BABYLON.Scene.FOGMODE_NONE</code> - 默认效果，雾是不活动的.</li>
                <li style="border-image: none; cursor: help;"><code style="border-image: none; cursor: help;">BABYLON.Scene.FOGMODE_EXP</code> - 雾的浓度按幂指数函数变化.</li>
                <li style="border-image: none; cursor: help;"><code style="border-image: none; cursor: help;">BABYLON.Scene.FOGMODE_EXP2</code> - 和上一个一样但是更快.</li>
                <li style="border-image: none; cursor: help;"><code style="border-image: none; cursor: help;">BABYLON.Scene.FOGMODE_LINEAR</code> - 雾的浓度按线性函数变化.</li></ul>
            <p style="border-image: none; cursor: help;">-&amp;gt;如果你选择了 <code style="border-image: none; cursor: help;">EXP</code>, 或者<code style="border-image: none; cursor: help;">EXP2</code>风格，那么你可以定义浓度选项（默认是 <code style="border-image: none; cursor: help;">0.1</code>):</p>
<pre><code class="lang-javascript hljs" style="border-image: none; cursor: help;">scene.fogDensity = 0.01;
</code></pre>
            <p style="border-image: none; cursor: help;">-&amp;gt; 或者，如果你选择了<code style="cursor: help;">LINEAR</code> 风格，那么你可以定义雾从哪里开始从哪里结束:</p>
<pre><code class="lang-javascript hljs" style="border-image: none; cursor: help;">scene.fogStart = 20.0;
    scene.fogEnd = 60.0;
</code></pre>
            <p style="border-image: none; cursor: help;">最后，无论何种风格，你可以设定雾的颜色（默认为<code style="border-image: none; cursor: help;">BABYLON.Color3(0.2, 0.2, 0.3)</code>):</p>
<pre><code class="lang-javascript hljs" style="border-image: none; cursor: help;">scene.fogColor = new BABYLON.Color3(0.9, 0.9, 0.85);
</code></pre>
            <p style="border-image: none; cursor: help;">看吧，我们告诉过你它是很简单的。</p>
            <p style="border-image: none; cursor: help;">如果你想查看并使用这个教程的playground场景，你可以<a href="http://babylonjs-playground.azurewebsites.net/?13"><strong style="border-image: none; cursor: help;">点击这里</strong></a>.</p>
            <h2 style="border-image: none; cursor: help;"><a name="next-step" class="anchor" href="http://doc.babylonjs.com/tutorials/Environment#next-step"></a>下一步</h2>
            <p style="border-image: none; cursor: help;">你应该已经有一个美丽的场景了，但是除了你的3D模型，你的世界是很平的，这是你的场景的耻辱。所以，在我们的下一篇教程中，我们将将你的平坦的地面编程美丽的山脉。去学习它，点击<a style="border-image: none; cursor: help;" href="http://doc.babylonjs.com/tutorials/Height_Map">这里!</a></p></div></div>
</div>

<!--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@-->

<footer class="footer"><div class="footer-item"><a style="border-image: none; cursor: help;" href="http://www.html5gamedevs.com/forum/16-babylonjs" target="_blank"><i class="fa fa-html5"></i>    Forum</a></div><div class="footer-item"><a style="border-image: none; cursor: help;" href="https://github.com/BabylonJS/Babylon.js" target="_blank"><i class="fa fa-github"></i>    Github</a></div><div class="footer-item"><a style="border-image: none; cursor: help;" href="https://github.com/BabylonJS/Documentation" target="_blank"><i class="fa fa-code-fork"></i>    Contribute</a></div></footer>
<div style="position: static; width: 0px; height: 0px; border: none; padding: 0px; margin: 0px;"><div id="trans-tooltip"><div id="tip-left-top" style="background: url(chrome-extension://ikkbfngojljohpekonpldkamedehakni/imgs/map/tip-left-top.png);"></div><div id="tip-top" style="background: url(chrome-extension://ikkbfngojljohpekonpldkamedehakni/imgs/map/tip-top.png) repeat-x;"></div><div id="tip-right-top" style="background: url(chrome-extension://ikkbfngojljohpekonpldkamedehakni/imgs/map/tip-right-top.png);"></div><div id="tip-right" style="background: url(chrome-extension://ikkbfngojljohpekonpldkamedehakni/imgs/map/tip-right.png) repeat-y;"></div><div id="tip-right-bottom" style="background: url(chrome-extension://ikkbfngojljohpekonpldkamedehakni/imgs/map/tip-right-bottom.png);"></div><div id="tip-bottom" style="background: url(chrome-extension://ikkbfngojljohpekonpldkamedehakni/imgs/map/tip-bottom.png) repeat-x;"></div><div id="tip-left-bottom" style="background: url(chrome-extension://ikkbfngojljohpekonpldkamedehakni/imgs/map/tip-left-bottom.png);"></div><div id="tip-left" style="background: url(chrome-extension://ikkbfngojljohpekonpldkamedehakni/imgs/map/tip-left.png);"></div><div id="trans-content"></div></div><div id="tip-arrow-bottom" style="background: url(chrome-extension://ikkbfngojljohpekonpldkamedehakni/imgs/map/tip-arrow-bottom.png);"></div><div id="tip-arrow-top" style="background: url(chrome-extension://ikkbfngojljohpekonpldkamedehakni/imgs/map/tip-arrow-top.png);"></div></div>

<!--@@下面是工具脚本@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@-->

<div id="div_hidden" style="display: none">
    <div id="div_mod1">
        <div class="div_inmod1" style="width: 100%;height: 100%;margin: 0px;border: 1px solid;padding: 0px;float: left;line-height: 20px" >
            <button onclick="ExportHtml()" style="margin-left: auto;margin-right: auto;float: left;position: relative;left: 10px">导出网页</button>
        </div>
    </div>
    <div id="div_mod2">
        <div class="div_inmod2" style="width: 100%;height: 100%;margin: 0px;border: 1px solid;padding: 0px;float: left;line-height: 20px">
            <div class="div_inmod_head" style="width: 100%;height: 20px;background-color: #E0ECFF;margin:0;border: 0;padding:0;border-bottom: 1px solid">
                <BUTTON title="点击关闭对话框" style='float:right;aposition:static; width: 14px;height: 14px; margin: 0;margin-top: 2px;margin-right:2px;padding: 0;background: url("") no-repeat;border: 0px;vertical-align:top' onclick="DeleteWindow();" type=submit></BUTTON>
                <BUTTON title="点击确定修改" style='float:right;aposition:static; width: 14px;height: 14px; margin: 0;margin-top: 2px;margin-right:2px;padding: 0;background: url("") no-repeat;border: 0px;vertical-align:top' onclick="ChangeValue();DeleteWindow();" type=submit></BUTTON>
                <BUTTON title="点击恢复上一历史状态" style='float:right;aposition:static; width: 14px;height: 14px; margin: 0;margin-top: 2px;margin-right:2px;padding: 0;background: url("") no-repeat;border: 0px;vertical-align:top' onclick="ReloadValue();DeleteWindow();" type=submit></BUTTON>
            </div>
            <textarea class="div_inmod2_content" style="width: 100%;height: 98px;overflow-x: hidden;margin:0;border: 0;padding:0" onchange=""></textarea>
        </div>
    </div>
</div>
<script src="../JS/MYLIB/MIN/Events.min.js"></script>
<script src="../JS/MYLIB/MIN/FileText.min.js"></script>
<script src="../JS/MYLIB/MIN/View.min.js"></script>
<script>
    var bbl_current_obj;
    var bbl_style_temp;
    var bbl_int_count2=0;
    var bbl_arr_history=[];
    window.onload=function()
    {
        delete_div("div_ExportHtml");
        if(true)
            return;
        Open_div("","div_ExportHtml",100,80,0,0);
        var div_ExportHtml=document.getElementById("div_ExportHtml");
        div_ExportHtml.innerHTML=document.getElementById("div_mod1").innerHTML;
        div_ExportHtml.style.position="fixed";
        div_ExportHtml.style.right="0px";
        div_ExportHtml.style.top="300px";
        //div_ExportHtml.style.float="right";
        var int_count=0;//为每一个可调整标签设置不同的tid属性
        var arr_tags=["p","a","span","h1","h2","h3","h4","h5","li","td","th","code","strong","em"];
        var leng=arr_tags.length;
        for(var i=0;i<leng;i++)//对于每一种标签
        {
            var objs=document.getElementsByTagName(arr_tags[i]);
            var leng2=objs.length;
            for(var j=0;j<leng2;j++)//对于每一个标签
            {
                var children=objs[j].childNodes;
                var leng3=children.length;
                for(var k=0;k<leng3;k++)//寻找文本节点
                {
                    if(children[k].nodeName=="#text"&&children[k].textContent.Trim().length>2)
                    {
                        objs[j].tid="tid"+int_count;
                        objs[j].style.cursor="help";
                        objs[j].onmouseover=function()
                        {
                            bbl_style_temp=this.style.border;
                            this.style.border="2px solid rgb(59, 203, 249)";
                            bbl_current_obj=objs[j];
                        }
                        objs[j].onmouseout=function()
                        {
                            this.style.border=bbl_style_temp;
                        }
                        objs[j].onclick=function(){
                            var evt=evt||window.event;
                            cancelEvent(evt);
                            cancelPropagation(evt);
                            //alert(this.textContent);
                            var arr_child=this.childNodes;
                            var leng4=arr_child.length;
                            //首先删除所有已经存在的对话框
                            for(var l=0;l<bbl_int_count2;l++)
                            {
                                delete_div("div_inmod2_"+l);
                            }
                            bbl_int_count2=0;
                            for(var l=0;l<leng4;l++)//对于其中的每一个文本节点，弹出修改对话框
                            {
                                if(arr_child[l].nodeName=="#text"&&arr_child[l].textContent.Trim().length>2)
                                {
                                    Open_div(this,"div_inmod2_"+bbl_int_count2,240,120,0+bbl_int_count2*250,0);
                                    var div_inmod2=document.getElementById("div_inmod2_"+bbl_int_count2);//取出新添加的元素
                                    div_inmod2.ttid=this.getAttribute("tid")?this.getAttribute("tid"):this.tid;//把被选择标签的全局标记交给弹出框
                                    div_inmod2.tobj=this;
                                    div_inmod2.textnum=l;//在文本框中记录，这个文本框对应的是标签的第几个子节点
                                    div_inmod2.innerHTML=document.getElementById("div_mod2").innerHTML;
                                    con_getElementsByClassName("div_inmod2_content",div_inmod2)[0].innerHTML=arr_child[l].textContent;//填入原有值，考虑标签嵌套问题//#text型标签没有innerhtml属性！！
                                    bbl_int_count2++;//记下有多少个，后面删除所有对话框时使用
                                }
                            }
                        }
                        break;
                    }
                }
            }
        }
    }
    function DeleteWindow()
    {//只删除掉点击关闭的这一个标签
        var evt=evt||window.event;
        cancelPropagation(evt);
        var obj=evt.currentTarget?evt.currentTarget:evt.srcElement;
        var str_id=obj.parentNode.parentNode.parentNode.id;
        delete_div(str_id);
    }
    //写入修改后的标签值，并写入日志
    function ChangeValue()
    {
        var evt=evt||window.event;
        cancelPropagation(evt);
        var obj=evt.currentTarget?evt.currentTarget:evt.srcElement;
        //document.getElementsByTagName()
        var div_inmod2=obj.parentNode.parentNode.parentNode;
        var obj_text=obj.parentNode.parentNode.getElementsByTagName("textarea")[0];//输入的文本框
        if(obj_text.innerHTML.trim().length<1)
        {
            alert("修改后的文本过短");
        }
        else {
            var tobj = div_inmod2.getAttribute("tobj") ? div_inmod2.getAttribute("tobj") : div_inmod2.tobj;//取得该输入框对应的标签
            var ttid = div_inmod2.getAttribute("tid") ? div_inmod2.getAttribute("tid") : div_inmod2.tid;//
            var textnum = div_inmod2.getAttribute("textnum") ? div_inmod2.getAttribute("textnum") : div_inmod2.textnum;
            //写日志
            var arr_temp = [];
            arr_temp.push(ttid + "&" + textnum);
            arr_temp.push(tobj.childNodes[textnum].textContent);
            bbl_arr_history.push(arr_temp);
            //改值
            tobj.childNodes[textnum].textContent = obj_text.innerHTML;
        }
    }
    //根据日志恢复标签内容
    function ReloadValue()
    {
        var evt=evt||window.event;
        cancelPropagation(evt);
        var obj=evt.currentTarget?evt.currentTarget:evt.srcElement;
        var div_inmod2=obj.parentNode.parentNode.parentNode;
        var tobj=div_inmod2.getAttribute("tobj")?div_inmod2.getAttribute("tobj"):div_inmod2.tobj;//取得该输入框对应的标签
        var ttid=div_inmod2.getAttribute("tid")?div_inmod2.getAttribute("tid"):div_inmod2.tid;//
        var textnum=div_inmod2.getAttribute("textnum")?div_inmod2.getAttribute("textnum"):div_inmod2.textnum;


        var flag=0;//0表示没有找到，对应的日志记录
        var leng=bbl_arr_history.length;
        for(var i=leng-1;i>=0;i--)
        {
            var str=ttid+"&"+textnum;
            if(bbl_arr_history[i][0]==str)//找到新的这一条
            {
                tobj.childNodes[textnum].textContent=bbl_arr_history[i][1];
                bbl_arr_history.splice(i,1);//将日志里的这一条删除
                flag=1;
                break;
            }
        }
        if(flag==0)
        {
            alert("没有日志记录！");
        }
    }
    //以html格式导出网页
    function ExportHtml()
    {
        DownloadText(MakeDateStr()+document.title,("<!DOCTYPE html><html>"+document.getElementsByTagName("html")[0].innerHTML+"</html>"));
    }
</script>
</body>
</html>